package com.lanou.myim.tools;

import android.media.MediaPlayer;

import java.io.IOException;

/**
 * Created by dllo on 16/3/21.
 */
public class PlayRecordingUtils {
    private MediaPlayer mediaPlayer;
    public void startPlaying(String path){
        mediaPlayer = new MediaPlayer();
        try {
            mediaPlayer.setDataSource(path);
            mediaPlayer.prepare();
            mediaPlayer.start();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public void stopPlaying(){
        if (mediaPlayer != null){
            mediaPlayer.release();
            mediaPlayer = null;
        }
    }
}
